#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    int N,K,k;
    cout<<"Vvedite N u K"<<endl;
    cin>>N;
    cin>>K;
    k=K;
    int A[N-1],B[4];
    cout<<"Vvedite massiv"<<endl;
    for(int i=0;i<N;i++)
    cin>>A[i];

    for(int i=0;i<(N-K);i++)
         B[i]=A[i+K+1];

    for(int i=0;i<=k;i++)
    {
        A[i+k+1]=A[i];
        A[i]=B[i];
    }
    for(int i=0;i<N;i++)
    cout<<endl<<A[i]<<endl;
    return a.exec();
}
